const {getMusicHttp} = require("../../utils/top-htp")
Page({

    /**
     * 页面的初始数据
     */
    data: {
        musics:[],
        offset:0
    },
    onLoad: function (options) {
        var offset = this.data.offset;
        getMusicHttp(offset).then(res=>{
            var musics = res.data.playlists;
            this.setData({
                musics
            })
        })
    },
    onReachBottom(){
        console.log("bottom");
        var offset=this.data.offset
        offset+=20;
        getMusicHttp(offset).then(res=>{
          var musics=this.data.musics;
          musics.push(...res.data.playlists)
          this.setData({
            musics,
            offset
          })
        })
    }
})